import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'login', //登录界面
      component: () => import('@/components/common/login'),
      meta: {
        needLogin: false
      }
    },
    {
      path: '/index', //教师主页
      component: () => import('@/components/admin/index'),
      children: [
        {
          path: '/', //首页默认路由
          component: () => import('@/components/common/hello')
        },
        {
          path:'/grade', //学生成绩
          component: () => import('@/components/charts/grade')
        },
        {
          path: '/gradeByExam', //学生分数段
          component: () => import('@/components/teacher/gradeByExam')
        },
        {
          path: '/scorePart',
          component: () => import('@/components/charts/scorePart')
        },
        {
          path: '/gradeByStudent', //所有学生成绩统计
          component: () => import('@/components/teacher/gradeByStudent')
        },
        {
          path: '/selectExam', //查询所有考试
          component: () => import('@/components/teacher/selectExam')
        },
        {
          path: '/addExam', //添加考试
          component: () => import('@/components/teacher/addExam')
        },
        {
          path: '/selectQuestion', //查询所有题库
          component: () => import('@/components/teacher/selectQuestion')
        },
        {
          path: '/addQuestion', //增加题库主界面
          component: () => import('@/components/teacher/addQuestion')
        },
        {
          path: '/addQuestionChildren', //点击试卷跳转到添加题库页面
          component: () => import('@/components/teacher/addQuestionChildren')
        },
        {
          path: '/studentManage', //学生管理界面
          component: () => import('@/components/teacher/studentManage')
        },
        {
          path: '/addStudent', //添加学生
          component: () => import('@/components/teacher/addStudent')
        },
        {
          path: '/teacherManage',
          component: () => import('@/components/admin/tacherManage')
        },
        {
          path: '/addTeacher',
          component: () => import ('@/components/admin/addTeacher')
        }
      ]
    },
    {
      path: '/student',
      component: () => import('@/components/student/index'),
      children: [
        {path:"/",component: ()=> import('@/components/student/myExam'),       meta: {
            needLogin: false
          }},
        {path: '/changePwd', component: () => import('@/components/student/changePwd'),       meta: {
            needLogin: true
          }},
        {path: '/examMsg', component: () => import('@/components/student/examMsg')},
        {path: '/studentScore', component: () => import("@/components/student/answerScore")},
        {path: '/scoreDetail', component: () => import("@/components/student/scoreDetail")},
        {path: '/myScore', component: () => import("@/components/student/myScore")}
      ]
    },
    {path: '/answer',component: () => import('@/components/student/answer')}
  ]
})
